<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
    <title>{:lang('BECOIN')}</title>
    <script src="__STATIC__/hybit/js/rem.js"></script>
    <link rel="stylesheet" href="__STATIC__/hybit/css/myCommon.css">
    <link rel="stylesheet" href="__STATIC__/hybit/css/swiper.min.css">
    <if cookie('think_var') == 'en-us'>
        <link rel="stylesheet" href="__STATIC__/hybit/css/style_en.css">
    <else/>
        <link rel="stylesheet" href="__STATIC__/hybit/css/style.css">
    </if>
</head>
<body>
    <div class="indexbg">
        <div class="indexhead" style="padding-top: 0;">
            <div class="indexheadtitle" style="position: relative;">
                <p style="display: flex;align-items: center;line-height: 0.8rem;text-align: left;font-weight: bold;font-size: 0.3rem;color: #848b99;"><img src="__STATIC__/hybit/images/slogo.png" style="width: 0.26rem;height: 0.3rem;margin-right: 0.05rem;" alt="">{:lang('BECOIN')}</p>
                <if cookie('think_var') == 'en-us'>
                    <a href="{:url('portal/index/language')}" style="display: block;width: 0.36rem;height: 0.36rem;position: absolute;top: 0.22rem;right: 0;"><img src="__STATIC__/hybit/images/en.png" alt="" style="width: 0.36rem;height: 0.36rem;display: block;"></a>
                <else/>
                    <a href="{:url('portal/index/language')}" style="display: block;width: 0.36rem;height: 0.36rem;position: absolute;top: 0.22rem;right: 0;"><img src="__STATIC__/hybit/images/cn.png" alt="" style="width: 0.36rem;height: 0.36rem;display: block;"></a>
                </if>
            </div>
           <div class="indexbanner">
               <div class="swiper-container index-lunbo1">
                    <div class="swiper-wrapper">
                        <foreach name="slide_item" item="vo">
                            <if cookie('think_var') == 'en-us'>
                                <div class="swiper-slide">
                                    <a <if $vo.url>href="{$vo.url}"</if>>
                                        <img src="{:cmf_get_image_preview_url($vo.image_en)}" alt="">
                                    </a>
                                </div>
                            <else/>
                                <div class="swiper-slide">
                                    <a <if $vo.url>href="{$vo.url}"</if>>
                                        <img src="{:cmf_get_image_preview_url($vo.image)}" alt="">
                                    </a>
                                </div>
                            </if>
                        </foreach>
                    </div>
                </div>
           </div>
        </div>
        <div class="hot">
           <div class="swiper-container index-lunbo2">
                <div class="swiper-wrapper">
                    <foreach name="notice_list" item="vo">
                        <div class="swiper-slide">
                            <a href="{:url('portal/index/notice')}">
                                <img src="__STATIC__/hybit/images/hot.png" alt="">
                                <if cookie('think_var') == 'en-us'>
                                    <p>{$vo.title_en}</p>
                                <else/>
                                    <p>{$vo.title}</p>
                                </if>
                                <img src="__STATIC__/hybit/images/right.png" alt="">
                            </a>
                        </div>
                    </foreach>
                </div>
            </div>
        </div>
        <div class="indexmid">
           <p class="indexmidtitle">{:lang('Total Assets')} 
                <if $user>
                <img src="__STATIC__/hybit/images/look.png" data-type="look" onclick="is_password(this)" alt="">
                <img src="__STATIC__/hybit/images/nolook.png" style="display: none;" onclick="is_password(this)" data-type="nolook" alt="">
                <else/>
                <img src="__STATIC__/hybit/images/look.png" alt="">
                </if>
            </p>
           <p class="indexmidp indexmidp1"><if $user>{:floatval($user.balance)} USDT ≈ {:round(floatval($user.balance)*get_usdt(),2)} CNY<else/>{:lang('LogIn')}</if></p>
           <p class="indexmidp indexmidp2" style="display: none;">**** USDT≈**** CNY</p>
           
           <div class="index_gg">
                <a href="{:url('user/zichan/index')}">
                <div class="index_gg1">
                    <h3>{:lang('Non Margin Account')}</h3>
                    <p class="index_ggp1"><if $user>{:floatval($user.balance)} USDT<else/>&nbsp;</if></p>
                    <p class="index_ggp2"><if $user>≈ {:round(floatval($user.balance)*get_usdt(),2)} CNY<else/>{:lang('LogIn')}</if></p>
                    <img src="__STATIC__/hybit/images/z_logo.png" alt="">
                </div>
                </a>
                
                <a href="{:url('user/zichan/index')}">
                <div class="index_gg2">
                    <h3>{:lang('Margin Account')}</h3>
                    <p class="index_ggp1"><if $user>0 USDT<else/>&nbsp;</if></p>
                    <p class="index_ggp2"><if $user>≈0 CNY<else/>{:lang('LogIn')}</if></p>
                    <img src="__STATIC__/hybit/images/z_logo.png" alt="">
                </div>
                </a>
            </div>
           
           
        </div>
        <div class="indexmindiv">
               <a href="{:url('user/zichan/chongzhi')}">
                   <img src="__STATIC__/hybit/images/index_money_d.png" alt="">
                   <p>{:lang('Charge')}</p>
               </a>
               <a href="{:url('user/zichan/tixian')}">
                   <img src="__STATIC__/hybit/images/index_money_u.png" alt="">
                   <p>{:lang('Withdraw')}</p>
               </a>
               <a href="{:url('portal/index/kefu')}">
                   <img src="__STATIC__/hybit/images/index_kefu.png" alt="">
                   <p>{:lang('Online Service')}</p>
               </a>
           </div>
        <div class="indexmid2">
            <foreach name="symbol_list" item="vo">
                <if $key lt 3>
                
                <div>
                    <p class="indexmid2p1">{$vo.name}/USDT <span id="{$vo.name}_zf"></span></p>
                    <p class="indexmid2p2" id="{$vo.name}_price"></p>
<!--                    <p class="indexmid2p3" id="{$vo.name}_zf"></p>-->
                    <p class="indexmid2p4" id="{$vo.name}_price_rmb"></p>
                    <img src="__STATIC__/hybit/images/l1.png" alt="">
                </div></if>
            </foreach>
        </div>
        <a class="index_fx" href="{:url('user/share/index')}">
           <div class="index_fxp">
               <p>{:lang('Share Friends')}</p>
               <p>{:lang('Super contract, global reputation')}</p>
           </div>
           <img src="__STATIC__/hybit/images/index_right.png" alt="">
        </a>
        <div class="indexlist">
           <div class="indexlisthead">
               <div class="active" data-type="indexlist_zf"><p>{:lang('Top Gainers')}</p></div>
               <div data-type="indexlist_df"><p>{:lang('Bottom Gainers')}</p></div>
               <div data-type="indexlist_cj"><p>{:lang('Vol Leaders')}</p></div>
           </div>
           <div class="indexlist_z indexlist_zf">
               <div class="indexlistnav">
                    <div>{:lang('Name')}</div>
                    <div>{:lang('Market Price')}</div>
                    <div>{:lang('Change')}</div>
               </div>
                <foreach name="zf_list" item="vo">
                <div class="indexlistshow">
                    <div class="listshow1">
                        <p>{$vo.name}<span>/USDT</span></p>
                        <p>24H {$vo.v}</p>
                    </div>
                    <div class="listshow1">
                        <p>{:floatval($vo.price)}</p>
                        <p>￥{:round(get_usdt()*$vo.price,2)}</p>
                    </div>
                    <div>
                        <p class="upup" style="background-color:green;">+{$vo.zf}%</p>
                    </div>
                </div>
                </foreach>
           </div>
           <div class="indexlist_z indexlist_df">
               <div class="indexlistnav">
                    <div>{:lang('Name')}</div>
                    <div>{:lang('Market Price')}</div>
                    <div>{:lang('Change')}</div>
               </div>
                <foreach name="df_list" item="vo">
                <div class="indexlistshow">
                    <div class="listshow1">
                        <p>{$vo.name}<span>/ USDT</span></p>
                        <p>24H {$vo.v}</p>
                    </div>
                    <div class="listshow1">
                        <p>{:floatval($vo.price)}</p>
                        <p>￥{:round(get_usdt()*$vo.price,2)}</p>
                    </div>
                    <div>
                        <p class="upup">{$vo.zf}%</p>
                    </div>
                </div>
                </foreach>
           </div>
           <div class="indexlist_z indexlist_cj">
               <div class="indexlistnav">
                    <div>{:lang('Name')}</div>
                    <div>{:lang('Market Price')}</div>
                    <div>24H{:lang('Vol')}(CNY)</div>
               </div>
                <foreach name="cj_list" item="vo">
                <div class="indexlistshow">
                    <div class="listshow1">
                        <p>{$vo.name}<span>/ USDT</span></p>
                        <p>24H {$vo.v}</p>
                    </div>
                    <div class="listshow1">
                        <p>{:floatval($vo.price)}</p>
                        <p>￥{:round(get_usdt()*$vo.price,2)}</p>
                    </div>
                    <div>
                        <p class="upup upcj">{:float_number(get_usdt()*$vo.a)}</p>
                    </div>
                </div>
                </foreach>
           </div>
        </div>
        <include file="public@navbar">
    </div>
    <script src="__STATIC__/hybit/js/jquery.min.js"></script>
    <script src="__STATIC__/hybit/js/swiper.min.js"></script>
    <script>

        var ustd_price = '{:get_usdt()}';

        var indexlunbo1 = new Swiper ('.index-lunbo1', {
            loop: true, // 循环模式选项
            speed: 300,
            autoplay: {
                disableOnInteraction: false, //手动滑动之后不打断播放
                delay: 2000
            },
        });
        var indexhotp = new Swiper ('.index-lunbo2', {
            loop: true, // 循环模式选项
            direction: 'vertical',
            speed: 300,
            autoplay: {
                disableOnInteraction: false, //手动滑动之后不打断播放
                delay: 2000
            },
        });
        
        $('.indexlisthead div').click(function(){
            let $this = $(this);
            $this.siblings().removeClass('active');
            $this.addClass('active');
            $this.parent().siblings().hide();
            let type = $this.attr('data-type');
            $('.' + type).show();
        });

        function get_new_symbol_price(){
            $.ajax({
                type: 'get',
                url: '{:url("portal/index/get_new_symbol_price")}',
                success:function(res){
                    console.log(res)
                    for(var key in res){
                        if(res[key].zf < 0){
                            $('#'+res[key].name+'_price').html(parseFloat(res[key].price));
                            $('#'+res[key].name+'_zf').html(res[key].zf+'%');
                            $('#'+res[key].name+'_price').css("color","red");
                            $('#'+res[key].name+'_zf').css("color","red");
                        }else{
                            $('#'+res[key].name+'_price').html(parseFloat(res[key].price));
                            $('#'+res[key].name+'_zf').html('+'+res[key].zf+'%');
                            $('#'+res[key].name+'_price').css("color","green");
                            $('#'+res[key].name+'_zf').css("color","green");
                        }
                        $('#'+res[key].name+'_price_rmb').html('≈'+(res[key].price*ustd_price).toFixed(2)+' CNY');
                    }
                }
            });
            setTimeout('get_new_symbol_price()',1000);
        }
        get_new_symbol_price();

        function is_password(obj){
            let $this = $(obj);
            let type = $this.attr('data-type');
            if(type == 'look'){
                $this.siblings('img').show();
                $this.hide();
                $('.indexmidp1').hide();
                $('.indexmidp2').show();
            }else{
                $this.siblings('img').show();
                $this.hide();
                $('.indexmidp1').show();
                $('.indexmidp2').hide();
            }
        }



        
    </script>
</body>
</html>